from pydantic import BaseModel, Field
from typing import List, Optional, Union
from datetime import datetime, date


class MapInfo(BaseModel):
    address: str = Field(title='城市名称')
    loc: List[Union[float, int]] = Field(title='坐标', description='第一个是经度，第二个是纬度')


class UserNum(BaseModel):
    value: int = Field(title='用户数')


class UserNumTendency(BaseModel):
    time: date
    value: int = Field(title='当前时刻的用户数')


class RenterMark(BaseModel):
    content: Optional[str] = Field(title='用户评价内容')
    star: int = Field(title='评分', description='0表示未评分。完成订单后48小时未评价的，默认5星好评。')
    create_time: datetime = Field(title='创建时间')
    driver_name: Optional[str] = Field(title='司机名')


class RenterComplaint(BaseModel):
    update_time: datetime = Field(title='更新时间')
    driver_name: Optional[str] = Field(title='司机名')
    reason: Optional[str] = Field(title='投诉原因')
    all_code_name: Optional[str] = Field(title='投诉编码名称全称，以横杠隔开')


class ComplaintTendency(BaseModel):
    begin_time: datetime
    end_time: datetime
    state: str = Field(title='状态')
    count: int = Field(title='统计的个数', default=0)


class RuleViolation(BaseModel):
    description: Optional[str] = Field(title='事故描述')
    address: Optional[str] = Field(title='违章地点')
    amount: Optional[int] = Field(title='罚款金额')
    create_time: datetime
    nature: Optional[str] = Field(title=r'事故性质(轻微\一般\严重)')


class UserFeedback(BaseModel):
    user_type: Optional[str] = Field(title=r'反馈人类型（乘客/司机/分时租赁用户）')
    content: Optional[str] = Field(title='反馈内容')
    time: datetime = Field(title='反馈时间')
    name: Optional[str] = Field(title='反馈人姓名')
